//
//  CollegeExaminationCollectionViewCell.m
//  Arts1
//
//  Created by 孤星晨宇 on 15/9/23.
//  Copyright (c) 2015年 Arts1. All rights reserved.
//

#import "CollegeExaminationCollectionViewCell.h"
#import "AllHeader.h"


@implementation CollegeExaminationCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        
        UIView *whiteView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH - 20, 60)];
        whiteView.backgroundColor = [UIColor whiteColor];
        whiteView.layer.cornerRadius = 4;
        whiteView.layer.masksToBounds = YES;
//        [UIView viewShadowColor:whiteView];
        
        _lineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 4, 60)];
        _lineView.backgroundColor = kColorforRandomColor;
//        [UIView viewRediusForTopAndBottomForLeft:_lineView withRedius:4];
//        _lineView.layer.masksToBounds = YES;
        [whiteView addSubview:_lineView];
        
        _titlelabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 0, 200, 30)];
        _titlelabel.text = @"上海视觉艺术学院2016年考试时间安排";
        _titlelabel.font = [UIFont systemFontOfSize:13];
        [whiteView addSubview:_titlelabel];
        
        _detailLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, _titlelabel.bottom, 200, 30)];
        _detailLabel.text = @"上海视觉艺术学院2016年考试";
        _detailLabel.font = [UIFont systemFontOfSize:10];
        [whiteView addSubview:_detailLabel];
        
        _circle = [[UIView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - 45, 27.5, 8 , 8)];
        _imageLayer = [CALayer layer];
        _imageLayer.frame = CGRectMake(0, 0, _circle.width, _circle.height);
        _imageLayer.cornerRadius = 4.0;  //设置layer圆角半径
        _imageLayer.masksToBounds = YES;  //隐藏边界
        _imageLayer.backgroundColor = (__bridge CGColorRef _Nullable)_lineView.backgroundColor;
        _imageLayer.borderWidth = 1.0;
        [_circle.layer addSublayer:_imageLayer];
        
        [whiteView addSubview:_circle];
        
        [self.contentView addSubview:whiteView];
    
    }
    return self;
}

- (void)setCount:(NSInteger)count{
    _count = count;
    if (_count == 0) {
        _lineView.backgroundColor = [UIColor redColor];
        _imageLayer.borderColor = [UIColor redColor].CGColor;
    } else {
        UIColor *color = kRandomColor;
        _lineView.backgroundColor = color;
        _imageLayer.borderColor = color.CGColor;
    }
}

- (void)setModel:(SSStateModel *)model{
    _model = model;
    _titlelabel.text = _model.title;
    _detailLabel.text = _model.addTime;
}


@end
